package com.ant.backstage.facade.enums;

import org.apache.commons.lang3.StringUtils;

public enum MailTypeEnum implements BaseEnum{

    // normal_mail普通文本邮件  img_slave_mail带图片/附件
    NORMAL_MAIL("normal_mail","普通文本邮件"),
    IMG_SLAVE_MAIL("img_slave_mail","带图片&附件邮件&验证码"),
    TEXT_SLAVE_MAIL("text_slave_mail","普通文本&附件邮件"),
    IMG_MAIL("img_mail","仅图片邮件"),
    GET_VERIFYCODE_MAIL("get_verifyCode","获取验证码")
    ;

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    MailTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static MailTypeEnum getByCode(String code) {
        if (StringUtils.isNotBlank(code)) {
            for (MailTypeEnum e : values()) {
                if (e.code.equals(code)) {
                    return e;
                }
            }
        }
        return null;
    }

}
